package com.wandian.cqcsk.adapter.mine;

import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.mylib.libcore.utils.GlideUtil;
import com.mylib.libcore.utils.UIUtils;
import com.wandian.cqcsk.R;
import com.wandian.cqcsk.bean.MySuggestBean;

/**
 * @author Administrator
 * @date 2019/12/16-13:32
 * @description MySuggestRecycleAdapter
 **/
public class MySuggestRecycleAdapter extends BaseQuickAdapter<MySuggestBean, BaseViewHolder> {

    public MySuggestRecycleAdapter(int layoutResId) {
        super(layoutResId);
    }


    @Override
    protected void convert(BaseViewHolder helper, MySuggestBean item) {

        TextView tv_time = helper.getView(R.id.tv_time);
        TextView tv_content = helper.getView(R.id.tv_content);
        TextView tv_hf = helper.getView(R.id.tv_hf);
        LinearLayout ll_img = helper.getView(R.id.ll_img);
        ImageView iv_img_1 = helper.getView(R.id.iv_img_1);
        ImageView iv_img_2 = helper.getView(R.id.iv_img_2);
        tv_time.setText(""+item.getCreateTime());
        tv_content.setText(""+item.getContent());
        if(UIUtils.isEmpty(item.getReply())){
            tv_hf.setVisibility(View.GONE);
        }else {
            tv_hf.setVisibility(View.VISIBLE);
            tv_hf.setText("平台回复："+item.getReply());
        }
        ll_img.setVisibility(View.GONE);
        if(!UIUtils.isEmpty(item.getImgStr())){
            String[] spList = item.getImgStr().split(",");
            if(!UIUtils.isEmpty(spList) && spList.length>0){
                ll_img.setVisibility(View.VISIBLE);
                for(int i=0;i<spList.length;i++){
                    if(i==0){
                        if(!UIUtils.isEmpty(spList[i])){
                            iv_img_1.setVisibility(View.VISIBLE);
                            GlideUtil.intoImg(mContext,spList[i],iv_img_1);
                        }
                    }
                    if(i==1){
                        if(!UIUtils.isEmpty(spList[i])){
                            iv_img_2.setVisibility(View.VISIBLE);
                            GlideUtil.intoImg(mContext,spList[i],iv_img_2);
                        }
                    }
                }
            }
        }


    }
}
